<?php
/*
	Muffinz CMS - A website content management system.
	Copyright (C) 2010-2011 Sigitas Zelenkovas

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
	
	Optionally you can also view the license at <http://www.gnu.org/licenses/>.
*/

class Plugin_MenuPanel{
	private $UniqueID = "eB859s61P27lDOt878QrGjI1FQ96WWL1";
	private $panelMenuItems = array();
	
	public function Add($text, $link, $toMain = true, $ali = true, $login = false){
		global $cTheme;
		if(!$login || ($login && !is_array($_SESSION['user']))){
			if($toMain){
				$cTheme->AddMenuItem($text, $link);
			}
			$this->panelMenuItems[] = array($text, $link, $ali); 
		}
	}
	
	public function Set(){
		global $cTheme, $panel;
		
		$buffer = "";
		foreach($this->panelMenuItems as $item){
			if($item[2] == true){
				$buffer .= "<li><a href=\"{$item[1]}\"><span class=\"bullet\">&middot;&nbsp;</span><span>{$item[0]}</span></a></li>";
			}else {
				$buffer .= "<li><span>{$item[0]}</span></li>";
			}
		}
		$cTheme->AddPanel("Menu", $buffer, $panel->GetPlace($this->UniqueID));
	}
	
	public function Admin(){
		
	}
}